// <editor-fold defaultstate="collapsed" desc="Đừng quan tâm"> 
/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package gui.khachhang;

import control.khachhang.KHMainPanel_ctrl;
import gui.event.khachhang.KHMainPanel_evt;
import java.util.ArrayList;
import java.util.List;
import javax.swing.ButtonGroup;
import javax.swing.JButton;
import javax.swing.JComponent;
import javax.swing.JTabbedPane;
import javax.swing.JTable;

/**
 *
 * @author nv_ca@live.com
 */
public class KHMainPanel extends javax.swing.JPanel {

    /**
     * Creates new form KHMainPanel
     */
    private List<JButton> listButtons;
    private List<JComponent> components;
    private ButtonGroup gLietKe, gSaoLuu, gPhucHoi;
    public KHMainPanel() {
        initComponents();
        this.setName("Quản Lý Khách Hàng");
        
        // thêm 2 button vào list button, để quản lý event khi chọn 1 row ở bảng khách hàng
        listButtons = new ArrayList<JButton>();
        listButtons.add(btnChiTiet);
        listButtons.add(btnSua);
        
        // thêm các radio button và button, để quản lý event nhấn vào check box nâng cao
        components = new ArrayList<JComponent>();
        components.add(rbtnSaoLuuDaChon);
        components.add(rbtnSaoLuuTuDong);
        components.add(btnThucHienSaoLuu);
        
        components.add(rbtnPhucHoiCuThe);
        components.add(rbtnPhucHoiTatCa);
        components.add(btnThucHienPhucHoi);
        
        // định nghĩa các group cho radio button
        gLietKe = new ButtonGroup();
        gLietKe.add(rbtnCoHenTaiKham);
        gLietKe.add(rbtnQua3Nam);
        gLietKe.add(rbtnTatCa);
        
        gSaoLuu = new ButtonGroup();
        gSaoLuu.add(rbtnSaoLuuDaChon);
        gSaoLuu.add(rbtnSaoLuuTuDong);
        
        gPhucHoi = new ButtonGroup();
        gPhucHoi.add(rbtnPhucHoiCuThe);
        gPhucHoi.add(rbtnPhucHoiTatCa);
        
        //Load tất cả khách hàng có dưới database lên bảng btlKhachHang.
        KHMainPanel_ctrl.loadAllKhachHang(btlKhachHang);
    }

    public JTable getBtlKhachHang() {
        return btlKhachHang;
    }

    public void setBtlKhachHang(JTable btlKhachHang) {
        this.btlKhachHang = btlKhachHang;
    }

    
    
    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        pnlDieuKienLietKe = new javax.swing.JPanel();
        txtTenKhachHang = new javax.swing.JTextField();
        jLabel2 = new javax.swing.JLabel();
        txtMaBacSi = new javax.swing.JFormattedTextField();
        rbtnTatCa = new javax.swing.JRadioButton();
        rbtnQua3Nam = new javax.swing.JRadioButton();
        rbtnCoHenTaiKham = new javax.swing.JRadioButton();
        btnLietKe = new javax.swing.JButton();
        spinSoLuongVatNuoi = new javax.swing.JSpinner();
        txtCoTenVatNuoiLa = new javax.swing.JTextField();
        jLabel7 = new javax.swing.JLabel();
        cboxCoVatNuoiThuocLoai = new javax.swing.JComboBox();
        txtTenBacSi = new javax.swing.JFormattedTextField();
        cboxTenKH = new javax.swing.JCheckBox();
        cboxMaBacSi = new javax.swing.JCheckBox();
        cboxTenBacSi = new javax.swing.JCheckBox();
        cboxTenVatNuoi = new javax.swing.JCheckBox();
        btnThem = new javax.swing.JButton();
        btnSua = new javax.swing.JButton();
        btnIn = new javax.swing.JButton();
        btnChiTiet = new javax.swing.JButton();
        jScrollPane1 = new javax.swing.JScrollPane();
        btlKhachHang = new javax.swing.JTable();
        pnlChucNangNangCao = new javax.swing.JPanel();
        pnlPhucHoi = new javax.swing.JPanel();
        rbtnPhucHoiTatCa = new javax.swing.JRadioButton();
        rbtnPhucHoiCuThe = new javax.swing.JRadioButton();
        btnThucHienPhucHoi = new javax.swing.JButton();
        pnlSaoLuu = new javax.swing.JPanel();
        rbtnSaoLuuDaChon = new javax.swing.JRadioButton();
        rbtnSaoLuuTuDong = new javax.swing.JRadioButton();
        btnThucHienSaoLuu = new javax.swing.JButton();
        ckboxBatChucNangNangCao = new javax.swing.JCheckBox();
        btnClose = new javax.swing.JButton();

        pnlDieuKienLietKe.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Điều kiện liệt kê", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, null, new java.awt.Color(0, 0, 204)));

        jLabel2.setText("Số lượng vật nuôi");

        txtMaBacSi.setFormatterFactory(new javax.swing.text.DefaultFormatterFactory(new javax.swing.text.DateFormatter(new java.text.SimpleDateFormat("dd/MM/yyyy"))));

        rbtnTatCa.setSelected(true);
        rbtnTatCa.setText("Tất cả");
        rbtnTatCa.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                rbtnTatCaActionPerformed(evt);
            }
        });

        rbtnQua3Nam.setText("Quá 3 năm");
        rbtnQua3Nam.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                rbtnQua3NamActionPerformed(evt);
            }
        });

        rbtnCoHenTaiKham.setText("Có hẹn tái khám");

        btnLietKe.setIcon(new javax.swing.ImageIcon(getClass().getResource("/gui/images/ultility/Filter-Standard-16.png"))); // NOI18N
        btnLietKe.setText("Liệt kê");
        btnLietKe.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnLietKeActionPerformed(evt);
            }
        });

        spinSoLuongVatNuoi.setModel(new javax.swing.SpinnerNumberModel(1, 0, 20, 1));

        jLabel7.setText("Có vật nuôi thuộc loài:");

        cboxCoVatNuoiThuocLoai.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" }));

        txtTenBacSi.setFormatterFactory(new javax.swing.text.DefaultFormatterFactory(new javax.swing.text.DateFormatter(new java.text.SimpleDateFormat("dd/MM/yyyy"))));

        cboxTenKH.setText("Tên khách hàng");

        cboxMaBacSi.setText("Mã bác Sĩ");

        cboxTenBacSi.setText("Tên bác sĩ");

        cboxTenVatNuoi.setText("Tên vật nuôi");

        javax.swing.GroupLayout pnlDieuKienLietKeLayout = new javax.swing.GroupLayout(pnlDieuKienLietKe);
        pnlDieuKienLietKe.setLayout(pnlDieuKienLietKeLayout);
        pnlDieuKienLietKeLayout.setHorizontalGroup(
            pnlDieuKienLietKeLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(pnlDieuKienLietKeLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(pnlDieuKienLietKeLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(pnlDieuKienLietKeLayout.createSequentialGroup()
                        .addGroup(pnlDieuKienLietKeLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jLabel2)
                            .addComponent(cboxTenKH))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(pnlDieuKienLietKeLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(txtTenKhachHang, javax.swing.GroupLayout.PREFERRED_SIZE, 143, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(spinSoLuongVatNuoi, javax.swing.GroupLayout.PREFERRED_SIZE, 73, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGap(119, 119, 119)
                        .addGroup(pnlDieuKienLietKeLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                            .addGroup(pnlDieuKienLietKeLayout.createSequentialGroup()
                                .addComponent(cboxTenBacSi)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                .addComponent(txtTenBacSi, javax.swing.GroupLayout.PREFERRED_SIZE, 200, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addGroup(pnlDieuKienLietKeLayout.createSequentialGroup()
                                .addComponent(cboxMaBacSi)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                .addComponent(txtMaBacSi, javax.swing.GroupLayout.PREFERRED_SIZE, 194, javax.swing.GroupLayout.PREFERRED_SIZE)))
                        .addGap(84, 84, 84)
                        .addGroup(pnlDieuKienLietKeLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jLabel7)
                            .addComponent(cboxTenVatNuoi))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(pnlDieuKienLietKeLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                            .addComponent(txtCoTenVatNuoiLa)
                            .addComponent(cboxCoVatNuoiThuocLoai, 0, 168, Short.MAX_VALUE)))
                    .addGroup(pnlDieuKienLietKeLayout.createSequentialGroup()
                        .addComponent(rbtnTatCa)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(rbtnQua3Nam)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(rbtnCoHenTaiKham)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addComponent(btnLietKe, javax.swing.GroupLayout.PREFERRED_SIZE, 99, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addContainerGap())
        );

        pnlDieuKienLietKeLayout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {txtMaBacSi, txtTenBacSi});

        pnlDieuKienLietKeLayout.setVerticalGroup(
            pnlDieuKienLietKeLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(pnlDieuKienLietKeLayout.createSequentialGroup()
                .addGroup(pnlDieuKienLietKeLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(pnlDieuKienLietKeLayout.createSequentialGroup()
                        .addContainerGap()
                        .addGroup(pnlDieuKienLietKeLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(txtTenKhachHang, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(txtMaBacSi, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(txtCoTenVatNuoiLa, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(cboxTenKH)
                            .addComponent(cboxMaBacSi)
                            .addComponent(cboxTenVatNuoi))
                        .addGap(18, 18, 18)
                        .addGroup(pnlDieuKienLietKeLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel2)
                            .addComponent(spinSoLuongVatNuoi, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(txtTenBacSi, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(cboxTenBacSi))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, pnlDieuKienLietKeLayout.createSequentialGroup()
                        .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addGroup(pnlDieuKienLietKeLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel7)
                            .addComponent(cboxCoVatNuoiThuocLoai, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGap(18, 18, 18)))
                .addGroup(pnlDieuKienLietKeLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(btnLietKe)
                    .addGroup(pnlDieuKienLietKeLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(rbtnTatCa)
                        .addComponent(rbtnQua3Nam)
                        .addComponent(rbtnCoHenTaiKham)))
                .addContainerGap())
        );

        btnThem.setIcon(new javax.swing.ImageIcon(getClass().getResource("/gui/images/khachhang/Customer-16 addnew.png"))); // NOI18N
        btnThem.setText("Thêm");
        btnThem.setToolTipText("Thêm Khách Hàng Mới");
        btnThem.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnThemActionPerformed(evt);
            }
        });

        btnSua.setIcon(new javax.swing.ImageIcon(getClass().getResource("/gui/images/khachhang/Customer-16 edit.png"))); // NOI18N
        btnSua.setText("Sửa...");
        btnSua.setToolTipText("Sửa Thông Tin Khách Hàng");
        btnSua.setEnabled(false);
        btnSua.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnSuaActionPerformed(evt);
            }
        });

        btnIn.setIcon(new javax.swing.ImageIcon(getClass().getResource("/gui/images/ultility/Printer-16.png"))); // NOI18N
        btnIn.setText("In...");
        btnIn.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnInActionPerformed(evt);
            }
        });

        btnChiTiet.setIcon(new javax.swing.ImageIcon(getClass().getResource("/gui/images/ultility/View-Details-16.png"))); // NOI18N
        btnChiTiet.setText("Chi tiết...");
        btnChiTiet.setEnabled(false);
        btnChiTiet.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnChiTietActionPerformed(evt);
            }
        });

        btlKhachHang.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {
                {"", null, null, null, null, null},
                {"KH0304201401", "Nguyễn Văn Chúc Ân", "Nam", "Đồng Nai", "21", "0972951554"},
                {null, null, null, null, null, null},
                {null, null, null, null, null, null},
                {null, null, null, null, null, null},
                {null, null, null, null, null, null},
                {null, null, null, null, null, null},
                {null, null, null, null, null, null},
                {null, null, null, null, null, null},
                {null, null, null, null, null, null},
                {null, null, null, null, null, null},
                {null, null, null, null, null, null},
                {null, null, null, null, null, null},
                {null, null, null, null, null, null},
                {null, null, null, null, null, null},
                {null, null, null, null, null, null},
                {null, null, null, null, null, null},
                {null, null, null, null, null, null},
                {null, null, null, null, null, null},
                {null, null, null, null, null, null},
                {null, null, null, null, null, null}
            },
            new String [] {
                "Mã KH", "Tên KH", "Giới tính", "Địa chỉ", "Tuổi", "Số ĐT"
            }
        ));
        btlKhachHang.setSelectionMode(javax.swing.ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
        btlKhachHang.addFocusListener(new java.awt.event.FocusAdapter() {
            public void focusGained(java.awt.event.FocusEvent evt) {
                btlKhachHangFocusGained(evt);
            }
        });
        jScrollPane1.setViewportView(btlKhachHang);

        pnlChucNangNangCao.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Chức Năng Nâng Cao", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, null, new java.awt.Color(0, 0, 204)));

        pnlPhucHoi.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Phục Hồi", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, null, java.awt.Color.blue));

        rbtnPhucHoiTatCa.setText("Phục hồi tất cả khách hàng đã được sao lưu");
        rbtnPhucHoiTatCa.setEnabled(false);

        rbtnPhucHoiCuThe.setSelected(true);
        rbtnPhucHoiCuThe.setText("Phục hồi khách hàng cụ thể");
        rbtnPhucHoiCuThe.setEnabled(false);

        btnThucHienPhucHoi.setText("Thực Hiện");
        btnThucHienPhucHoi.setEnabled(false);
        btnThucHienPhucHoi.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnThucHienPhucHoiActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout pnlPhucHoiLayout = new javax.swing.GroupLayout(pnlPhucHoi);
        pnlPhucHoi.setLayout(pnlPhucHoiLayout);
        pnlPhucHoiLayout.setHorizontalGroup(
            pnlPhucHoiLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(pnlPhucHoiLayout.createSequentialGroup()
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addGroup(pnlPhucHoiLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, pnlPhucHoiLayout.createSequentialGroup()
                        .addGroup(pnlPhucHoiLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(rbtnPhucHoiTatCa)
                            .addComponent(rbtnPhucHoiCuThe))
                        .addGap(87, 87, 87))
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, pnlPhucHoiLayout.createSequentialGroup()
                        .addComponent(btnThucHienPhucHoi)
                        .addGap(50, 50, 50))))
        );
        pnlPhucHoiLayout.setVerticalGroup(
            pnlPhucHoiLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(pnlPhucHoiLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(rbtnPhucHoiTatCa)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(rbtnPhucHoiCuThe)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addComponent(btnThucHienPhucHoi))
        );

        pnlSaoLuu.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Sao Lưu", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, null, new java.awt.Color(0, 0, 204)));

        rbtnSaoLuuDaChon.setText("Sao lưu danh sách đã chọn ở bảng bên");
        rbtnSaoLuuDaChon.setEnabled(false);

        rbtnSaoLuuTuDong.setSelected(true);
        rbtnSaoLuuTuDong.setText("Sao lưu tự động (khách hàng không đến sau 3 năm)");
        rbtnSaoLuuTuDong.setEnabled(false);

        btnThucHienSaoLuu.setText("Thực Hiện");
        btnThucHienSaoLuu.setEnabled(false);
        btnThucHienSaoLuu.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnThucHienSaoLuuActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout pnlSaoLuuLayout = new javax.swing.GroupLayout(pnlSaoLuu);
        pnlSaoLuu.setLayout(pnlSaoLuuLayout);
        pnlSaoLuuLayout.setHorizontalGroup(
            pnlSaoLuuLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(pnlSaoLuuLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(pnlSaoLuuLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(pnlSaoLuuLayout.createSequentialGroup()
                        .addComponent(rbtnSaoLuuDaChon)
                        .addGap(0, 0, Short.MAX_VALUE))
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, pnlSaoLuuLayout.createSequentialGroup()
                        .addGap(0, 0, Short.MAX_VALUE)
                        .addGroup(pnlSaoLuuLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                            .addComponent(btnThucHienSaoLuu)
                            .addComponent(rbtnSaoLuuTuDong))
                        .addGap(87, 87, 87))))
        );
        pnlSaoLuuLayout.setVerticalGroup(
            pnlSaoLuuLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(pnlSaoLuuLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(rbtnSaoLuuDaChon)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(rbtnSaoLuuTuDong)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addComponent(btnThucHienSaoLuu))
        );

        ckboxBatChucNangNangCao.setText("Bật chức năng nâng cao");
        ckboxBatChucNangNangCao.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                ckboxBatChucNangNangCaoActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout pnlChucNangNangCaoLayout = new javax.swing.GroupLayout(pnlChucNangNangCao);
        pnlChucNangNangCao.setLayout(pnlChucNangNangCaoLayout);
        pnlChucNangNangCaoLayout.setHorizontalGroup(
            pnlChucNangNangCaoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(pnlChucNangNangCaoLayout.createSequentialGroup()
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addGroup(pnlChucNangNangCaoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addComponent(pnlSaoLuu, javax.swing.GroupLayout.PREFERRED_SIZE, 296, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(ckboxBatChucNangNangCao)
                    .addComponent(pnlPhucHoi, javax.swing.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE)))
        );
        pnlChucNangNangCaoLayout.setVerticalGroup(
            pnlChucNangNangCaoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(pnlChucNangNangCaoLayout.createSequentialGroup()
                .addComponent(ckboxBatChucNangNangCao)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(pnlSaoLuu, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 49, Short.MAX_VALUE)
                .addComponent(pnlPhucHoi, javax.swing.GroupLayout.PREFERRED_SIZE, 101, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap())
        );

        btnClose.setIcon(new javax.swing.ImageIcon(getClass().getResource("/gui/images/ultility/Close-16.png"))); // NOI18N
        btnClose.setText("Đóng");
        btnClose.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnCloseActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
        this.setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addComponent(btnThem, javax.swing.GroupLayout.PREFERRED_SIZE, 95, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(btnSua, javax.swing.GroupLayout.PREFERRED_SIZE, 95, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(btnIn, javax.swing.GroupLayout.PREFERRED_SIZE, 59, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(btnChiTiet)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addComponent(btnClose, javax.swing.GroupLayout.PREFERRED_SIZE, 79, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(9, 9, 9))
                    .addComponent(jScrollPane1)
                    .addComponent(pnlDieuKienLietKe, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(pnlChucNangNangCao, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(4, 4, 4))
        );

        layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {btnClose, btnIn, btnSua, btnThem});

        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(pnlDieuKienLietKe, javax.swing.GroupLayout.PREFERRED_SIZE, 127, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(btnSua)
                    .addComponent(btnIn)
                    .addComponent(btnThem)
                    .addComponent(btnChiTiet)
                    .addComponent(btnClose))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 387, Short.MAX_VALUE)
                    .addGroup(layout.createSequentialGroup()
                        .addComponent(pnlChucNangNangCao, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(0, 0, Short.MAX_VALUE))))
        );
    }// </editor-fold>//GEN-END:initComponents
//</editor-fold> 
    private void btnThemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnThemActionPerformed
        KHMainPanel_evt.btnThemActionPerformed(btlKhachHang);
        
    }//GEN-LAST:event_btnThemActionPerformed

    private void btnSuaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnSuaActionPerformed
        
        KHMainPanel_evt.btnSuaActionPerformed(btlKhachHang);
        
        
    }//GEN-LAST:event_btnSuaActionPerformed

    private void btnInActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnInActionPerformed
        KHMainPanel_evt.btnInActionPerformed(btlKhachHang);
    }//GEN-LAST:event_btnInActionPerformed

    private void btnChiTietActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnChiTietActionPerformed
        KHMainPanel_evt.btnChiTietActionPerformed(btlKhachHang);
    }//GEN-LAST:event_btnChiTietActionPerformed

    private void btnCloseActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnCloseActionPerformed
        KHMainPanel_evt.btnCloseActionPerformed(this, (JTabbedPane)this.getParent());
    }//GEN-LAST:event_btnCloseActionPerformed

    private void btnLietKeActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnLietKeActionPerformed
        KHMainPanel_evt.btnLietKeActionPerformed();
        KHMainPanel_ctrl.lietKeTheoTenKhachHang(txtTenKhachHang, btlKhachHang);
        btlKhachHang.resetKeyboardActions();
       
    }//GEN-LAST:event_btnLietKeActionPerformed

    private void btlKhachHangFocusGained(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_btlKhachHangFocusGained
       KHMainPanel_evt.btlKhachHangFocusGained(this.listButtons, this.btlKhachHang);
    }//GEN-LAST:event_btlKhachHangFocusGained

    private void ckboxBatChucNangNangCaoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_ckboxBatChucNangNangCaoActionPerformed
        if (ckboxBatChucNangNangCao.isSelected()) {
              KHMainPanel_evt.enableListComponents(this.components);
        } else {
              KHMainPanel_evt.disableListComponents(this.components);
        }
    }//GEN-LAST:event_ckboxBatChucNangNangCaoActionPerformed

    private void btnThucHienSaoLuuActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnThucHienSaoLuuActionPerformed
       KHMainPanel_evt.btnThucHienSaoLuuActionPerformed();
    }//GEN-LAST:event_btnThucHienSaoLuuActionPerformed

    private void btnThucHienPhucHoiActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnThucHienPhucHoiActionPerformed
        KHMainPanel_evt.btnThucHienPhucHoiActionPerformed();
    }//GEN-LAST:event_btnThucHienPhucHoiActionPerformed

    private void rbtnTatCaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_rbtnTatCaActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_rbtnTatCaActionPerformed

    private void rbtnQua3NamActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_rbtnQua3NamActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_rbtnQua3NamActionPerformed

// <editor-fold defaultstate="collapsed" desc="Đừng quan tâm cái này luôn nha!"> 

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JTable btlKhachHang;
    private javax.swing.JButton btnChiTiet;
    private javax.swing.JButton btnClose;
    private javax.swing.JButton btnIn;
    private javax.swing.JButton btnLietKe;
    private javax.swing.JButton btnSua;
    private javax.swing.JButton btnThem;
    private javax.swing.JButton btnThucHienPhucHoi;
    private javax.swing.JButton btnThucHienSaoLuu;
    private javax.swing.JComboBox cboxCoVatNuoiThuocLoai;
    private javax.swing.JCheckBox cboxMaBacSi;
    private javax.swing.JCheckBox cboxTenBacSi;
    private javax.swing.JCheckBox cboxTenKH;
    private javax.swing.JCheckBox cboxTenVatNuoi;
    private javax.swing.JCheckBox ckboxBatChucNangNangCao;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel7;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JPanel pnlChucNangNangCao;
    private javax.swing.JPanel pnlDieuKienLietKe;
    private javax.swing.JPanel pnlPhucHoi;
    private javax.swing.JPanel pnlSaoLuu;
    private javax.swing.JRadioButton rbtnCoHenTaiKham;
    private javax.swing.JRadioButton rbtnPhucHoiCuThe;
    private javax.swing.JRadioButton rbtnPhucHoiTatCa;
    private javax.swing.JRadioButton rbtnQua3Nam;
    private javax.swing.JRadioButton rbtnSaoLuuDaChon;
    private javax.swing.JRadioButton rbtnSaoLuuTuDong;
    private javax.swing.JRadioButton rbtnTatCa;
    private javax.swing.JSpinner spinSoLuongVatNuoi;
    private javax.swing.JTextField txtCoTenVatNuoiLa;
    private javax.swing.JFormattedTextField txtMaBacSi;
    private javax.swing.JFormattedTextField txtTenBacSi;
    private javax.swing.JTextField txtTenKhachHang;
    // End of variables declaration//GEN-END:variables

   
}
//</editor-fold>